<template>
  <div class="page page-search">
    <template v-if="showIcon">
      <div class="page-search-left">
        <slot></slot>
      </div>
      <div v-if="showText" class="page-search-more" @click="handleClick">
        更多查询
        <i :class="`iconfont ${showMore ? 'icon-shouqi' : 'icon-zhankai'}`"></i>
      </div>
    </template>
    <slot v-else></slot>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

const props = defineProps({
  showMore: Boolean,
  showIcon: {
    type: Boolean,
    default: true
  },
  showText: {
    type: Boolean,
    default: true
  }
})

const emit = defineEmits(['update:showMore'])

const handleClick = () => {
  console.log(props.showMore, "showMore---点击")
  emit("update:showMore", !props.showMore) // ✅ Vue 3 里 emit 更新 v-model
}
</script>

<style lang="less" scoped>
@import "./style";
</style>
